﻿#ifndef PST_POLARCOORDINATEGRAPHSETTINGDIALOG_H
#define PST_POLARCOORDINATEGRAPHSETTINGDIALOG_H

#include <IdaDialogFrame>
#include "InfomationCurve2DBasical.h"
QT_BEGIN_NAMESPACE
namespace Ui
{
    class PolarCoordinateGraphSettingDialog;
};
QT_END_NAMESPACE

class QTableWidget;

namespace pst
{
    class PolarCoordinateGraphCenterSettingData;

    class PolarCoordinateGraphSettingDialog : public IdaDialogFrame
    {
        Q_OBJECT

    public:
        PolarCoordinateGraphSettingDialog(QWidget* parent = nullptr);
        ~PolarCoordinateGraphSettingDialog();

        void initWidget();

        void initData(PolarCoordinateGraphCenterSettingData* polarCoordinateGraphCenterSettingData);

        void ChangeCurrentWidget(int index);

        void setWindowUniversalID(int windowUniversalID);
        void setIndexOfGraph(int index);
        int getIndexOfGrapg() const;
        void setCurveInfoID(int curveInfoID) { m_curveInfoID = curveInfoID; };
        int getCurveInfoID() const { return m_curveInfoID; };

    signals:
        void signal_sendData(int windowUniversalID, int curveInfoID, Info2DPointer info = nullptr);

    private slots:

        void reject() override;

        void accept() override;

        void slot_apply();

    private:
        QTableWidget* initData_angleAxisDisplay();
        QTableWidget* initData_angleAxisRange();
        QTableWidget* initData_radiusAxisDisplay();
        QTableWidget* initData_radiusAxisRange();
        QTableWidget* initData_grid();
        QTableWidget* initData_title();
        QTableWidget* initData_legend();
        QTableWidget* initData_dataProperty();

        void saveUIData_angleAxisDisplay();
        void saveUIData_angleAxisRange();
        void saveUIData_radiusAxisDisplay();
        void saveUIData_radiusAxisRange();
        void saveUIData_grid();
        void saveUIData_title();
        void saveUIData_legend();
        void saveUIData_dataProperty();

        void updateUIData_angleAxisDisplay();
        void updateUIData_angleAxisRange();
        void updateUIData_radiusAxisDisplay();
        void updateUIData_radiusAxisRange();
        void updateUIData_grid();
        void updateUIData_title();
        void updateUIData_legend();
        void updateUIData_dataProperty();

        // public: // python调用
        //     void pySaveUIData_angleAxisDisplay(QString angDisAxisColor, int angDisAxisThickness, double angDisValuePrecision, QString angDisAxisDigitColor, int angDisAxisDigitSize);
        //     void pySaveUIData_angleAxisRange(bool angRangIsAutoStepSize, int angRangCustomStepSize);
        //     void pySaveUIData_radiusAxisDisplay(QString radDisAxisColorStr, int radDisAxisThickness, double radDisValuePrecision, QString radDisAxisDigitColorStr, int radDisAxisDigitSize);
        //     void pySaveUIData_radiusAxisRange(bool radRangIsAutoRange, double radRangMaxValue, double radRangMinValue, bool radRangIsAutoStepSize, double radRangCustomStepSize);
        //     void pySaveUIData_grid(bool gridIsMainGridLineDisplay, QString gridMainGridLineColor, int gridMainGridLineStyle, double gridMainGridLineThickness);
        //     void pySaveUIData_title(QString titleName, QString titleFontColor, int titleFontSize);
        //     void pySaveUIData_legend(QString legendFontColor, int legendFontSize, QString legendLineColor, int legendLineThickness);
        //     void pySaveUIData_dataProperty(QString dataProResultDataName, QString dataProDataLineColor, int dataProDataLineStyle, double dataProDataLineThickness, bool dataProIsDisplaySymbol, int dataProSymbolStyle, double dataProSymbolSize, QString dataProSymbolColor);
    signals:
        void pyScriptIsRunning();

    private:
        Ui::PolarCoordinateGraphSettingDialog* ui;
        PolarCoordinateGraphCenterSettingData* m_polarCoordinateGraphCenterSettingData;
        QTableWidget* m_tableWidget_angleAxisDisplay;
        QTableWidget* m_tableWidget_angleAxisRange;
        QTableWidget* m_tableWidget_radiusAxisDisplay;
        QTableWidget* m_tableWidget_radiusAxisRange;
        QTableWidget* m_tableWidget_grid;
        QTableWidget* m_tableWidget_title;
        QTableWidget* m_tableWidget_legend;
        QTableWidget* m_tableWidget_dataProperty;

        int m_windowUniversalID;
        int m_curveInfoID{-1};
        int m_indexOfGraph{-1};
        QStringList m_pyCode; // python脚本
        bool m_execSuccess;
    };
} // namespace pst
#endif // PST_DIALOGPOLARCOORDINATE_H
